Theory

Synthetic figures, ignoring baseline levels of each type.

2x2

library(tidyverse)
x2 <- read_csv(here::here("data", "2x2.csv"))
# 
# x2 %>% 
#   ggplot() +
#   aes(x = x, y = new, label = lab) +
#   geom_line(aes(y = baseline), linetype = 2, alpha = .5) + 
#   geom_line() +
#   geom_ribbon(aes(ymax = new, ymin = baseline), alpha = .2) + 
#   facet_wrap("outcome", nrow = 2) + 
#   geom_label() +  
#   geom_text(aes(label = lab2, y = baseline), check_overlap = T, hjust = 0, vjust = -.2) +
#   labs(y = "Change in Level Provided\n(e.g., the number of requests to agencies)",
#        title = "") + 
#   theme_void() + 
#   xlim(-.2,1.2) + 
#   ylim(-1.1,3.1) + 
#   theme(panel.border = element_rect(fill=NA),
#         axis.title.y = element_text(angle = 90))



x2 %>% 
  ggplot() +
  aes(x = x, y = new, label = lab) +
  geom_line(aes(y = baseline), linetype = 2, alpha = .5) + 
  geom_line() +
  geom_ribbon(aes(ymax = new, ymin = baseline), alpha = .2) + 
  facet_grid(priority ~ capacity) +
  geom_label() +  
  geom_text(y = 0, 
            label = "Baseline levels for new legislator\n(may differ between service and policy work)",
            aes(x = ifelse(capacity == "Capacity DOES affect behavior" & priority == "Shifting priorities DO affect behavior", 0.5, NA))) +
  labs(y = "Change in Level Provided\n(e.g., the number of requests to agencies)",
       title = "",
       x = "") + 
  #theme_minimal() + 
  xlim(-.2,1.2) + 
  ylim(-1.1,3.1) + 
  theme(panel.grid = element_blank(),
        panel.border = element_rect(fill=NA),
        axis.text = element_blank(),
        axis.ticks = element_blank(),
        panel.background = element_blank())
Divergent Predictions for the Change in Levels of Constituency Service and Policy Work as Legislators Gain Experience and Power

Divergent Predictions for the Change in Levels of Constituency Service and Policy Work as Legislators Gain Experience and Power

# x2 %>% 
#   ggplot() +
#   aes(x = x, y = new, label = lab) +
#   #geom_point(aes(y = baseline), alpha = .5) + 
#   #geom_line() +
#   geom_segment(aes(yend = baseline, xend = x), alpha = .2, size = 20) + 
#   facet_wrap("outcome", nrow = 2) + 
#   geom_label() +  
#   geom_text(aes(label = lab2, y = baseline), check_overlap = T, hjust = 0, vjust = 1.5) +
#   labs(y = "Change in Level Provided\n(e.g., the number of requests to agencies)",
#        title = "") + 
#   theme_void() + 
#   xlim(-.1,1.1) + 
#   ylim(-1.1,3.1) + 
#   theme(panel.border = element_rect(fill=NA),
#         axis.title.y = element_text(angle = 90))

1x2

# just 
x2 %>% 
  filter(outcome %in% c("3. Only Increased Capacity Affects Behavior", "2. Only Shifting Priorities Affect Behavior")) %>% 
  mutate(outcome = str_remove(outcome, "[1-9].*Only ")) %>%
  ggplot() +
  aes(x = x, y = new, label = lab) +
  geom_line(aes(y = baseline), linetype = 2, alpha = .5) + 
  geom_line() +
  geom_ribbon(aes(ymax = new, ymin = baseline), alpha = .2) + 
  facet_wrap("outcome", nrow = 1) + 
  geom_label() +  
  geom_text(y = 0, 
            vjust = 1.1,
            label = "Baseline levels for a new legislator\n(may differ between service & policy work)",
            aes(x = ifelse(outcome == "Increased Capacity Affects Behavior", 0.5, NA))) +
  labs(y = "Change in Level Provided\n(e.g., the number of\nrequests to agencies)",
       title = "") + 
  theme_void() + 
  xlim(-.3,1.3) + 
  ylim(-1.1,1.1) + 
  theme(panel.border = element_rect(fill=NA),
        axis.title.y = element_text(angle = 90))
Divergent Predictions for the Change in Levels of Constituency Service and Policy Work as Legislators Gain Experience and Power

Divergent Predictions for the Change in Levels of Constituency Service and Policy Work as Legislators Gain Experience and Power

Data

FOIA <- read_csv(here("data/_FOIA_response_table.csv")) %>% select(-ends_with("1")) %>% 
  mutate(Department = Department %>% str_remove_all("Department of the|Department of ")) 

FOIA %>% 
  kablebox_long()
Department Components FOIAed Records received Coded Observations
Agriculture 29 29 11 9603
Commerce 19 18 10 7791
Defense 49 13 7 9806
Education 1 1 1 4676
Energy 8 2 1 6256
Health and Human Services 15 10 7 109701
Homeland Security 14 13 12 153151
Housing and Urban Development 2 1 1 32158
Justice 23 6 3 3096
Labor 22 12 9 62353
State 1 0 0 0
Transportation 10 7 6 26885
Veterans Affairs 6 3 2 90808
Interior 11 8 6 6067
Treasury 7 5 5 23853
Independent Agencies 77 47 30 81152
Total 294 175 111 627356
FOIA %>% select(-Coded) %>%
  rename(N = Observations) %>% 
  kable(format = "latex", booktabs = T) %>%
  row_spec(row = 16, hline_after = TRUE) %>%
  row_spec(row = 17, bold = T) %>% 
  #kable_styling(font_size = 9, full_width = TRUE) %>% 
       write_file(here::here("docs", "tables", "FOIA.tex")) 
# can't cache data

# new raw data 
load(
  here::here("data", "all_contacts.Rdata") %>% 
       str_replace("Correspondence","correspondence_data")
     ) 

all_contacts %>% count() %>% pull(n)  %>% write(file = here::here("docs/tables/n"))

all_contacts %>% count(TYPE != "NA") %>% pull(n) %>% .[[2]] %>% write(file = here::here("docs/tables/n_coded"))

n_agencies <- all_contacts $agency %>% unique() %>% length()

write(n_agencies, file = here::here("docs", "tables", "n_agencies"))
# 
# # old raw data 
# load(
#   here::here("data", "all_contacts2.Rdata") 
#      ) 

all_contacts |> count(agency) |> kablebox()
agency n
ABMC 78
Amtrak 1433
CNCS 836
CSOSA 34
DHHS_ACF 691
DHHS_ACL 112
DHHS_CDC 8578
DHHS_CMS 68555
DHHS_FDA 12495
DHHS_HRSA 10626
DHHS_IHS 1222
DHHS_NIH 7422
DHS_HQ 36622
DHS_ICE 642
DHS_USCIS 115887
DOC_EDA 925
DOC_IOS 339
DOC_MBDA 9
DOC_NIST 262
DOC_NOAA 50
DOC_NTIA 116
DOC_OCPA 52
DOC_OS 1486
DOC_SBA 4552
DOD_DFAS 688
DOD_DLA_Aviation 224
DOD_DeCA 531
DOD_Navy 4475
DOD_OIG 1654
DOD_OSDJS 1908
DOD_USACE 326
DOE_FERC 6256
DOI_BOEM 1398
DOI_BSEE 89
DOI_NIGC 6
DOI_NPS 4255
DOI_OSMRE 47
DOI_SOL 77
DOI_USGS 195
DOJ_CIV 1800
DOJ_ENRD 613
DOJ_EOIR 683
DOL_EBSA 10096
DOL_ETA 9000
DOL_MSHA 945
DOL_OASAM 397
DOL_OCFO 22
DOL_OFCCP 543
DOL_OSHA 2548
DOL_OWCP 10944
DOL_SOL 26862
DOL_VETS 996
DOT_FAA 12275
DOT_FHWA 9229
DOT_FRA 2705
DOT_FTA 2177
DOT_PHMSA 482
DOT_SLSDC 17
ED 4676
EEOC 823
EOP_CEQ 234
EOP_USTR 6998
EPA 10906
FCA 53
FCC 6068
FHFA 2849
FTC 12890
HUD_HQ 32158
NARA 9836
NASA 2777
NCPC 12
NCUA 351
NLRB 635
NWTRB 4
PRC 360
RRB 2325
SSA 4365
TVA 82
Treasury_Fiscal 11592
Treasury_IRS 10993
Treasury_OCC 1268
USDA 5006
USDA_ERS 42
USDA_FS 658
USDA_NASS 77
USDA_NIFA 121
USDA_NRCS 556
USDA_RD 2488
USDA_RMA 655
USPS 17203
VA 90788
VA_CEM 20
all_contacts |> count(year) |> kablebox()
year n
2000 311
2001 812
2002 799
2003 686
2004 2783
2005 5522
2006 5204
2007 23376
2008 35731
2009 44956
2010 48743
2011 49610
2012 43545
2013 43491
2014 45727
2015 41503
2016 43352
2017 32911
2018 134375
2019 12896
2020 11023
all_contacts %>% filter(year >2006, year <2018) %>%  dim()
## [1] 452945    117
all_contacts2 <- all_contacts #FIXME 

#load(here::here("data", "all_contacts_paper.Rdata"))

all_contacts2 %<>% mutate(type = ifelse(TYPE %in% c(1,2,3), "Constituency\nService", NA) ) %>%
  mutate(type = ifelse(TYPE %in% c(4,5), "Policy\nWork", type) )

all_contacts2$Type %<>% str_replace("Indiv. Constituent" , "Constituent (Individual)") %>% 
  str_replace("Corp. Constituent" , "Constituent (Corporate)")%>% 
  str_replace("501c3 or Local Gov." , "Constituent (501c3 or Local Gov.)")%>% 
  str_replace("Corp. Policy" , "Policy (Corporate)")%>% 
  str_replace("^Policy$" , "Policy (General)")


load(here::here("data", "dcounts_min.Rdata"))
load(here::here("data", "dcounts_tenure.Rdata"))
load(here::here("data", "dcounts_ratio.Rdata"))
load(here::here("data", "dcounts_per_district.Rdata"))


load(here::here("data", "members.Rdata"))

members %<>% mutate(member_state = member_state %>%
                     str_replace("\\) ", "-") %>%
                     str_c(")")) 


congress_years2<- function(congress){
        years<- c(congress*2 + 1787, congress*2 + 1788 ) %>% str_c(collapse = ";", sep = ";")
        return(years)
}

# FIXME members data should have years so we don't merge in observations for members in the january (final days of their last term)
# members2 <- members %>%
# mutate(year = congress %>%  congress_years2() %>% str_c(collapse = ";"))

# CAUTION THIS IS WRONG AND WILL PRINT OUT ALL YEARS IN DATA ^2
# members2$year[1]

load(here::here('data', 'agency_vars.Rdata'))

congress_years<- function(congress){
        years<- c(congress*2 + 1787, congress*2 + 1788 )
        return(years)
}

year_congress<- function(year){
    return(floor((year - 1787)/2))
}



d <- dcounts_min %>% 
  ungroup() %>% 
  mutate(type = ifelse(TYPE %in% c(1,2,3), "Constituency\nService", NA) ) %>%
  mutate(type = ifelse(TYPE %in% c(4,5), "Policy\nWork", type) )

type <- d %>% 
  group_by(type) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup()


type %>% 
  rename(type2 = type) %>%
  mutate(percent = n/sum(type$n[1:2])*100) %>% kablebox()
type2 n percent
Constituency Service
43616
Work
 8259
type5 <- d %>% 
  group_by(TYPE) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() 

type5 %<>% 
  mutate(percent = n/sum(type5$n[2:6])*100)

type5 %>% kablebox()
TYPE n percent
3 0.0006599
0 5117 1.1255678
1 367633 80.8668874
2 30773 6.7690243
3 37763 8.3065891
4 13329 2.9319314
5 69267 15.2364088
6 2584 0.5683930
NA 100887 22.1917447
type2017 <- d %>% 
  filter(year> 2006, year < 2018) %>%
  group_by(type) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>%
  ungroup()

type2020 <- d %>% 
  filter(year> 2006, year < 2021) %>%
  group_by(type) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>%
  ungroup()

write(sum(type2020$n), file = "tables/n2007-2020")

coded <- d %>% 
    filter(year> 2006, year < 2021) %>%
  mutate(coded = !is.na(type)) %>% 
  group_by(coded) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) 

coded %>% filter(coded) %>% .$n |> write(file = "tables/n2007-2020coded")

coded_ratio = coded$n[2]/(sum(coded$n))

multiplier = sum(coded$n)/coded$n[2]

percent <- function(x){
  y <- x*100 
  y %<>% round() 
  return(y)}
# percent(.434534523453)

d %<>% filter(chamber != "President")

d %<>% mutate(congress = year_congress(year))




dcounts <- d %>% left_join(members)


type2xchair <- dcounts %>% 
  group_by(type, chair) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  drop_na(type, chair) %>% 
  group_by(chair) %>% 
  mutate(percent = n / sum(n) *100) 

type2xchair%>% 
  kablebox()
type chair n percent
Constituency Service
Service
Work
Work
type2xprestigechair <- dcounts %>% 
  group_by(type, prestige_chair) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  drop_na() %>% 
  group_by(prestige_chair) %>% 
  mutate(percent = n / sum(n) *100) 

type2xprestigechair%>% 
  kablebox()
type prestige_chair n percent
Constituency Service
Service
Work
Work
# prestige committee
type2xprestige <- dcounts %>% 
  group_by(type, prestige) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  drop_na() %>% 
  group_by(prestige) %>% 
  mutate(percent = n / sum(n) *100) 


type2xprestige%>% 
  kablebox()
type prestige n percent
Constituency Service
Service
Work
Work
type2xchamber <- dcounts %>%
  group_by(type, chamber) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  drop_na() %>% 
  group_by(chamber) %>% 
  mutate(percent = n / sum(n) *100) 


# year
type2xyear <- dcounts %>% mutate(years = year  - yearelected) %>% 
  group_by(type, years) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  drop_na() %>% 
  group_by(years) %>% 
  mutate(percent = n / sum(n) *100) 

type2xyear %>% 
  kablebox()
type years n percent
Constituency Service
Service
Work
Work
#  averages 
dcounts %>%
  group_by(year, bioname) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  arrange(-n) %>%
  summarise(mean_per_year = mean(n) %>% round(0)) %>% 
  kablebox()
mean_per_year
55
# chamber averages 
dcounts %>%
  group_by(chamber, year, bioname) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  arrange(-n) %>%
  group_by(chamber) %>% 
  summarise(mean_per_year = mean(n) %>% round(0)) %>% 
  kablebox()
chamber mean_per_year
House 40
Senate 117
# per member 
dcounts %>% 
  group_by(bioname, year) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  arrange(-n) %>%
  group_by(bioname) %>% 
  mutate(mean_per_year = mean(n) %>% round(0)) %>% 
  kablebox_long()
bioname year n mean_per_year
DURBIN, Richard Joseph 2018 1571 242
RUBIO, Marco 2018 1570 377
KLOBUCHAR, Amy 2018 1479 256
MENG, Grace 2018 1469 216
CLARKE, Yvette Diane 2018 1382 128
SCHUMER, Charles Ellis (Chuck) 2018 1380 358
DIAZ-BALART, Mario 2018 1219 98
TOOMEY, Patrick Joseph 2018 1193 258
ISAKSON, Johnny 2018 1159 208
GILLIBRAND, Kirsten 2018 1142 375
PORTMAN, Robert Jones (Rob) 2018 1118 114
SHAHEEN, Jeanne 2018 1082 254
WARNER, Mark 2014 1039 426
VAN HOLLEN, Christopher 2018 1037 177
BROWN, Sherrod 2018 1018 213
NELSON, Clarence William (Bill) 2018 1004 370
WARREN, Elizabeth 2018 1002 218
CORNYN, John 2018 946 242
PASCRELL, William J., Jr.  2018 935 69
TILLIS, Thomas Roland (Thom) 2018 931 237
DONOVAN, Daniel M., Jr.  2018 871 244
JEFFRIES, Hakeem 2018 867 120
KAINE, Timothy Michael (Tim) 2018 865 245
BOOKER, Cory Anthony 2018 862 302
HARRIS, Kamala Devi 2018 861 238
WEBB, James H. (Jim) 2010 860 533
GUTIÉRREZ, Luis V. 2018 854 56
CASEY, Robert (Bob), Jr.  2018 848 294
MURPHY, Christopher 2018 822 107
CHAMBLISS, Saxby 2009 821 165
CARDIN, Benjamin Louis 2018 820 153
SERRANO, José E. 2018 818 50
VELÁZQUEZ, Nydia M. 2018 810 56
MEEKS, Gregory W. 2018 790 53
McCAIN, John Sidney, III 2015 785 258
CURBELO, Carlos 2018 782 240
SMITH, Tina 2018 772 209
CONNOLLY, Gerald E. (Gerry) 2018 760 125
SCHUMER, Charles Ellis (Chuck) 2012 745 358
BYRD, Robert Carlyle 2009 709 204
DUCKWORTH, Tammy 2018 706 157
CROWLEY, Joseph 2018 704 60
PETERS, Gary C. 2018 681 107
BYRD, Robert Carlyle 2008 679 204
NELSON, Clarence William (Bill) 2010 676 370
WYDEN, Ronald Lee 2018 676 118
MIKULSKI, Barbara Ann 2010 667 249
GRASSLEY, Charles Ernest 2010 663 252
COMSTOCK, Barbara J. 2018 656 349
SCHUMER, Charles Ellis (Chuck) 2010 656 358
BURR, Richard M. 2018 652 157
WARNER, Mark 2015 649 426
GILLIBRAND, Kirsten 2013 633 375
NELSON, Clarence William (Bill) 2009 623 370
McCAIN, John Sidney, III 2016 620 258
WEBB, James H. (Jim) 2008 620 533
WEBB, James H. (Jim) 2009 619 533
REED, John F. (Jack) 2018 615 108
ALEXANDER, Lamar 2018 607 159
CORKER, Robert (Bob) 2018 604 168
GRASSLEY, Charles Ernest 2011 603 252
MOULTON, Seth 2018 602 157
WATSON COLEMAN, Bonnie 2018 600 125
CORTEZ MASTO, Catherine Marie 2018 596 168
DAVIS, Rodney 2018 593 170
NELSON, Clarence William (Bill) 2011 591 370
GILLIBRAND, Kirsten 2012 587 375
NADLER, Jerrold Lewis 2018 584 49
SCHUMER, Charles Ellis (Chuck) 2009 582 358
SIRES, Albio 2018 571 55
MALONEY, Carolyn Bosher 2018 569 74
DURBIN, Richard Joseph 2009 566 242
LUGAR, Richard Green 2010 564 203
WOODALL, Rob 2018 563 94
BEYER, Donald Sternoff Jr.  2018 562 180
O’ROURKE, Beto 2018 562 172
SCHUMER, Charles Ellis (Chuck) 2016 562 358
NELSON, Clarence William (Bill) 2013 556 370
KHANNA, Rohit 2018 552 146
ESPAILLAT, Adriano J. 2018 551 151
LUGAR, Richard Green 2011 550 203
MIKULSKI, Barbara Ann 2013 550 249
GRAHAM, Lindsey O. 2018 547 148
STABENOW, Deborah Ann 2018 547 111
HASTINGS, Alcee Lamar 2018 546 61
MIKULSKI, Barbara Ann 2011 545 249
SCHNEIDER, Brad 2018 545 117
COOPER, James Hayes Shofner 2018 542 43
NELSON, Clarence William (Bill) 2012 539 370
LANKFORD, James 2018 534 102
MANCHIN, Joe, III 2011 527 281
MARKEY, Edward John 2018 526 72
GILLIBRAND, Kirsten 2011 521 375
ESHOO, Anna Georges 2018 519 58
SCHUMER, Charles Ellis (Chuck) 2011 517 358
GILLIBRAND, Kirsten 2014 512 375
DONNELLY, Joe 2018 510 92
WOLF, Frank Rudolph 2009 507 212
HATCH, Orrin Grant 2018 503 111
GOMEZ, Jimmy 2018 502 129
# per member HOUSE
dcounts %>% 
  filter(chamber == "House") %>% 
  group_by(bioname, year) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  arrange(-n) %>%
  group_by(bioname) %>% 
  mutate(mean_per_year = mean(n) %>% round(0)) %>% 
  kablebox_long()
bioname year n mean_per_year
MENG, Grace 2018 1469 216
CLARKE, Yvette Diane 2018 1382 128
DIAZ-BALART, Mario 2018 1219 98
PASCRELL, William J., Jr.  2018 935 69
DONOVAN, Daniel M., Jr.  2018 871 244
JEFFRIES, Hakeem 2018 867 120
GUTIÉRREZ, Luis V. 2018 854 56
SERRANO, José E. 2018 818 50
VELÁZQUEZ, Nydia M. 2018 810 56
MEEKS, Gregory W. 2018 790 53
CURBELO, Carlos 2018 782 240
CONNOLLY, Gerald E. (Gerry) 2018 760 125
CROWLEY, Joseph 2018 704 60
COMSTOCK, Barbara J. 2018 656 349
MOULTON, Seth 2018 602 157
WATSON COLEMAN, Bonnie 2018 600 125
DAVIS, Rodney 2018 593 170
NADLER, Jerrold Lewis 2018 584 49
SIRES, Albio 2018 571 55
MALONEY, Carolyn Bosher 2018 569 74
WOODALL, Rob 2018 563 94
BEYER, Donald Sternoff Jr.  2018 562 180
O’ROURKE, Beto 2018 562 172
KHANNA, Rohit 2018 552 146
ESPAILLAT, Adriano J. 2018 551 151
HASTINGS, Alcee Lamar 2018 546 61
SCHNEIDER, Brad 2018 545 117
COOPER, James Hayes Shofner 2018 542 43
ESHOO, Anna Georges 2018 519 58
WOLF, Frank Rudolph 2009 507 212
GOMEZ, Jimmy 2018 502 129
PINGREE, Chellie 2018 502 73
LOWEY, Nita M. 2018 498 52
WOLF, Frank Rudolph 2010 497 212
ROS-LEHTINEN, Ileana 2018 484 64
SOTO, Darren Michael 2018 484 235
ENGEL, Eliot Lance 2018 481 46
WOLF, Frank Rudolph 2011 480 212
VISCLOSKY, Peter 2018 470 113
LIEU, Ted 2018 456 106
PALLONE, Frank, Jr.  2018 447 91
SCHAKOWSKY, Janice D. 2018 443 62
BARR, Garland H. (Andy) IV 2018 437 111
SCHIFF, Adam 2018 430 53
FRELINGHUYSEN, Rodney P. 2018 427 69
GALLEGO, Ruben 2018 423 88
JOHNSON, Hank 2018 422 102
SUOZZI, Thomas 2018 416 134
LEWIS, John R. 2018 411 52
DELANEY, John 2018 402 113
WOLF, Frank Rudolph 2012 400 212
PELOSI, Nancy 2018 398 47
PRICE, David Eugene 2018 395 46
CAPUANO, Michael Everett 2018 393 37
ADAMS, Alma 2018 390 68
WOLF, Frank Rudolph 2008 388 212
SPEIER, Karen Lorraine Jacqueline (Jackie) 2018 382 56
PANETTA, James Varni 2018 381 120
SMITH, Christopher Henry 2018 380 63
JAYAPAL, Pramila 2018 370 119
KINZINGER, Adam 2018 370 56
McGOVERN, James P. 2018 368 44
CASTOR, Kathy 2018 362 85
CÁRDENAS, Tony 2018 357 76
WALTERS, Mimi 2018 356 118
LOUDERMILK, Barry D. 2018 353 127
COLLINS, Chris 2018 352 107
SINEMA, Kyrsten 2018 351 92
GRAVES, Tom 2018 349 84
LANCE, Leonard 2018 347 76
OLSON, Pete 2018 344 64
DOYLE, Michael F. 2018 342 44
GARRETT, Scott 2014 341 105
BROWNLEY, Julia 2018 337 109
COFFMAN, Mike 2018 337 69
McCAUL, Michael T. 2012 335 173
SHIMKUS, John M. 2010 334 97
LOFGREN, Zoe 2018 333 35
COMSTOCK, Barbara J. 2016 332 349
GARRETT, Scott 2016 332 105
McCAUL, Michael T. 2010 331 173
HIMES, James A. 2018 326 62
ZELDIN, Lee M 2018 326 88
SESTAK, Joe 2010 317 224
WITTMAN, Robert J. 2018 316 116
CURTIS, John R. 2018 314 82
KEATING, William R. 2018 313 66
McCAUL, Michael T. 2009 312 173
GRIJALVA, Raúl M. 2018 311 63
SHIMKUS, John M. 2009 310 97
YARMUTH, John 2018 309 63
DENT, Charles W. 2010 307 122
RODRIGUEZ, Ciro D. 2008 306 96
GOTTHEIMER, Josh S. 2018 304 112
GOODLATTE, Robert William 2014 302 124
RICE, Kathleen Maura 2018 302 127
CASTRO, Joaquin 2018 301 65
CHU, Judy 2018 301 62
PAYNE, Donald, Jr.  2018 300 45
EDWARDS, Donna F. 2009 299 97
# per member VA-10
dcounts %>% 
  filter(cqlabel == "(VA-10)") %>% 
  group_by(bioname, year) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  arrange(year) %>%
  group_by(bioname) %>% 
  mutate(mean_per_year = mean(n) %>% round(0)) %>% 
  kablebox_long()
bioname year n mean_per_year
WOLF, Frank Rudolph 2000 0 212
WOLF, Frank Rudolph 2001 1 212
WOLF, Frank Rudolph 2002 0 212
WOLF, Frank Rudolph 2003 4 212
WOLF, Frank Rudolph 2004 23 212
WOLF, Frank Rudolph 2005 47 212
WOLF, Frank Rudolph 2006 53 212
WOLF, Frank Rudolph 2007 238 212
WOLF, Frank Rudolph 2008 388 212
WOLF, Frank Rudolph 2009 507 212
WOLF, Frank Rudolph 2010 497 212
WOLF, Frank Rudolph 2011 480 212
WOLF, Frank Rudolph 2012 400 212
WOLF, Frank Rudolph 2013 280 212
WOLF, Frank Rudolph 2014 257 212
COMSTOCK, Barbara J. 2015 245 349
COMSTOCK, Barbara J. 2016 332 349
COMSTOCK, Barbara J. 2017 164 349
COMSTOCK, Barbara J. 2018 656 349
WEXTON, Jennifer 2019 36 40
WEXTON, Jennifer 2020 43 40
dcounts %>% 
  group_by(bioname, year) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  arrange(n) %>%
  group_by(bioname) %>% 
  mutate(mean_per_year = mean(n) %>% round(0)) %>% 
  #FIXME 
  filter(n > 4) %>% 
  kablebox_long()
bioname year n mean_per_year
ADERHOLT, Robert 2005 5 44
ADERHOLT, Robert 2006 5 44
ALEXANDER, Rodney 2006 5 99
ALLEN, George 2003 5 23
ALLEN, Thomas H. 2003 5 9
AMASH, Justin 2019 5 43
BACHUS, Spencer T., III 2006 5 34
BAIRD, Brian 2006 5 17
BAKER, Richard Hugh 2004 5 3
BALDACCI, John Elias 2001 5 3
BALDERSON, Troy 2019 5 14
BARTON, Joe Linus 2003 5 36
BARTON, Joe Linus 2004 5 36
BENNETT, Robert 2005 5 11
BENNETT, Robert 2006 5 11
BIDEN, Joseph Robinette, Jr.  2005 5 11
BIDEN, Joseph Robinette, Jr.  2009 5 11
BISHOP, Robert (Rob) 2007 5 24
BLACKBURN, Marsha 2005 5 36
BLUMENAUER, Earl 2004 5 25
BLUMENAUER, Earl 2006 5 25
BLUMENAUER, Earl 2019 5 25
BOEHLERT, Sherwood Louis 2004 5 4
BONAMICI, Suzanne 2019 5 41
BONILLA, Henry 2004 5 2
BONNER, Jr., Josiah Robins (Jo) 2006 5 68
BOUCHER, Frederick C. 2001 5 24
BOUCHER, Frederick C. 2006 5 24
BOXER, Barbara 2002 5 140
BRADY, Kevin Patrick 2020 5 32
BRADY, Robert A. 2002 5 26
BREAUX, John Berlinger 2001 5 9
BROOKS, Mo 2019 5 47
BROWN, Henry Edward, Jr.  2005 5 32
BROWN, Henry Edward, Jr.  2006 5 32
BROWN, Sherrod 2002 5 213
BROWN, Sherrod 2006 5 213
BURGESS, Michael C. 2006 5 41
BURNS, Conrad 2001 5 9
BURR, Richard M. 2002 5 157
BURR, Richard M. 2004 5 157
BURTON, Danny Lee 2006 5 23
CAMPBELL, John (of California) 2006 5 22
CAPITO, Shelley Moore 2006 5 46
CAPPS, Lois 2003 5 45
CAPUANO, Michael Everett 2004 5 37
CAPUANO, Michael Everett 2005 5 37
CARDIN, Benjamin Louis 2004 5 153
CARDIN, Benjamin Louis 2005 5 153
CARSON, André 2019 5 33
CASE, Ed 2006 5 5
CASTLE, Michael Newbold 2005 5 11
CHABOT, Steve 2019 5 19
CLAY, William Lacy, Jr.  2005 5 36
CLINTON, Hillary Rodham 2009 5 56
COLEMAN, Norm 2004 5 42
COOK, Paul 2019 5 40
COOK, Paul 2020 5 40
CORNYN, John 2003 5 242
CORZINE, Jon Stevens 2002 5 4
CUNNINGHAM, Joe 2020 5 7
CURTIS, John R. 2020 5 82
DAVIS, Jim 2005 5 1
DEAL, John Nathan 2004 5 15
DIAZ-BALART, Mario 2004 5 98
DICKS, Norman DeValois 2001 5 19
DICKS, Norman DeValois 2004 5 19
DINGELL, Debbie 2019 5 54
DODD, Christopher John 2002 5 58
DORGAN, Byron Leslie 2005 5 28
DUNN, Jennifer Blackburn 2001 5 3
DeFAZIO, Peter Anthony 2004 5 44
DeFAZIO, Peter Anthony 2005 5 44
DeLAURO, Rosa L. 2004 5 52
ESHOO, Anna Georges 2004 5 58
FARR, Sam 2001 5 31
FEINGOLD, Russell Dana 2002 5 92
FILNER, Bob 2001 5 66
FINKENAUER, Abby 2019 5 6
FLORES, Bill 2020 5 47
FRIST, William H. 2004 5 3
FRIST, William H. 2006 5 3
GALLEGLY, Elton W. 2006 5 21
GARAMENDI, John 2020 5 61
GERLACH, Jim 2005 5 60
GIANFORTE, Greg 2019 5 19
GIBBONS, James A. 2005 5 2
GILCHREST, Wayne Thomas 2006 5 9
GONZALEZ, Charles A. 2005 5 20
GRANGER, Kay 2005 5 26
GREGG, Judd Alan 2001 5 58
GRIJALVA, Raúl M. 2005 5 63
GUEST, Michael 2020 5 6
GUTIÉRREZ, Luis V. 2005 5 56
HAGEL, Charles Timothy (Chuck) 2004 5 15
HALL, Ralph Moody 2006 5 23
HASTERT, John Dennis 2005 5 3
HASTINGS, Richard Norman (Doc) 2002 5 24
HASTINGS, Richard Norman (Doc) 2004 5 24
HERGER, Walter William (Wally) 2002 5 42

Example

Rep. Barbara Comstock worked in Rep. Frank Wolf’s congressional office for five years, described him as a “longtime mentor,” and claimed that Wolf first urged her to run for office. He endorsed and campaigned with her.

Notice several patterns - dip in constituency service when Wolf is no longer running for re-election - further dip with transition - quick rebound as Comstock gets her office in order - inheriting a highly-effective office, Comstock is far above average house member

cq <- "(VA-10)"

dcounts %>% 
  group_by(member_state, year, chamber, cqlabel) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  group_by(chamber) %>% 
  mutate(mean_per_chamber = mean(n) %>% round(0)) %>% 
  filter(cqlabel == cq, year > 2007, year <2017) %>% 
  ggplot() +
  aes(x = year, y = n, fill = member_state) + 
  geom_col(alpha = .5, position = "dodge") +
  geom_hline(aes(yintercept = mean_per_chamber), linetype = 2) + 
  geom_text(aes(y = mean_per_chamber), x = 2007.5, label = "House mean", min.segment.length = 0, size = 3, fill = NA, vjust = -.3, hjust = 0) + 
  scale_x_continuous(breaks = seq(2008, 2016, 1)) +
  labs(x = "",
       y = "Number of Requests", 
       fill = cq %>% str_remove_all("\\(|\\)")) + 
  theme_minimal() + 
  theme(panel.grid.major.x =  element_blank(),
        panel.grid.minor.x =  element_blank(),
        axis.text.x = element_text(angle = 45))+ 
    scale_fill_viridis_d(begin = 0, end = .6, option = "cividis", direction = -1) 

cq <- "(NY-07)"
CHAMBER <- "House"
dcounts %>% 
  group_by(member_state, year, chamber, cqlabel) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  group_by(chamber) %>% 
  mutate(mean_per_chamber = mean(n) %>% round(0)) %>% 
    filter(cqlabel == cq, year > 2007, year <2018) %>% 
  ggplot() +
  aes(x = year, y = n, 
      fill = member_state %>% str_replace("-.*", "\\)")) + 
  geom_col(alpha = .5, position = "dodge") +
  geom_hline(aes(yintercept = mean_per_chamber), linetype = 2) + 
  geom_text(aes(y = mean_per_chamber), x = 2007.5, label = "Chamber average", min.segment.length = 0, size = 3, fill = NA, vjust = 1.3, hjust = 0) + 
  scale_x_continuous(breaks = seq(2007, 2017, 1)) +
  labs(x = "",
       y = "Number of Requests", 
       fill = str_c(CHAMBER, "-", cq) %>% str_remove_all("\\(|\\)") ) + 
  theme_minimal() + 
  theme(panel.grid.major.x =  element_blank(),
        panel.grid.minor.x =  element_blank(),
        axis.text.x = element_text(angle = 45))+ 
    scale_fill_viridis_d(begin = 0, end = .6, option = "cividis", direction = -1) 

cq <- "(NY-14)"
CHAMBER <- "House"
dcounts %>% 
  group_by(member_state, year, chamber, cqlabel) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  group_by(chamber) %>% 
  mutate(mean_per_chamber = mean(n) %>% round(0)) %>% 
  filter(cqlabel == cq, year > 2007, year <2018) %>% 
  #drop_na(year) %>%
  ggplot() +
  aes(x = year, y = n, 
      fill = member_state %>% str_replace("-.*", "\\)")) + 
  geom_col(alpha = .5, position = "dodge") +
  geom_hline(aes(yintercept = mean_per_chamber), linetype = 2) + 
  geom_text(aes(y = mean_per_chamber), x = 2007.5, label = "Chamber average", min.segment.length = 0, size = 3, fill = NA, vjust = 1.3, hjust = 0) + 
  scale_x_continuous(breaks = seq(2008, 2017, 1)) +
  labs(x = "",
       y = "Number of Requests", 
       fill = str_c(CHAMBER, "-", cq) %>% str_remove_all("\\(|\\)") ) + 
  theme_minimal() + 
  theme(panel.grid.major.x =  element_blank(),
        panel.grid.minor.x =  element_blank(),
        axis.text.x = element_text(angle = 45))+ 
    scale_fill_viridis_d(begin = 0, end = .6, option = "cividis", direction = -1) 

case_study <- function(cq){

  CHAMBER <- filter(members, cqlabel == cq) %>% 
    .$chamber %>% .[1]

dcounts %>% 
  group_by(member_state, year, chamber, cqlabel) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
  ungroup() %>% 
  group_by(chamber) %>% 
  mutate(mean_per_chamber = mean(n) %>% round(0)) %>% 
  filter(cqlabel == cq, year > 2007, year <2017) %>% 
  ggplot() +
  aes(x = year, 
      y = n, 
      fill = member_state %>% str_replace("-.*", "\\)")) + 
  geom_col(alpha = .5, position = "dodge") +
  geom_hline(aes(yintercept = mean_per_chamber), linetype = 2) + 
  geom_text(aes(y = mean_per_chamber), x = 2007.5, label = "Chamber average",# min.segment.length = 0,
            size = 3, vjust = 1.3, hjust = 0) + 
  scale_x_continuous(breaks = seq(2008, 2016, 1)) +
  labs(x = "",
       y = "Number of Requests", 
       fill = str_c(CHAMBER, "-", cq) %>% str_remove_all("\\(|\\)") ) + 
  theme_minimal() + 
  theme(panel.grid.major.x =  element_blank(),
        panel.grid.minor.x =  element_blank(),
        axis.text.x = element_text(angle = 45))+ 
    scale_fill_viridis_d(begin = 0, end = .6, option = "cividis", direction = -1) 
  
ggsave(str_c("figs/districts/", cq, ".png"), 
       width = 5.3,
  height = 2.5,
  dpi = 1000)
} 

case_study("(WI)")

case_study("(WI-07)")

cases <- unique(members$cqlabel) #%>% head()

# map(cases, case_study )

Between February 2017 and February 2021, we received data on 627356 instances of members of Congress contacting federal agencies. We focus on requests made from 2007-2012, resulting in a data set of 452945 contacts from members of Congress with federal agencies.

Requests by percentile

dcounts %>% 
    group_by(member_state, chamber, year) %>% summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>%
  group_by(member_state, chamber) %>% 
  summarise(mean = mean(n)) %>% 
  ungroup() %>% 
    group_by(chamber) %>% 
  mutate(Percentile = ntile(mean, 100),
         rank = dense_rank(-mean)) %>% 
  arrange(-Percentile) %>% 
  dplyr::select(member_state, Percentile, mean, chamber,rank) %>% distinct() %>% 
    ggplot() + 
    geom_col(aes(x = Percentile, y = mean), 
             color = "grey", 
             width = .000001,
             fill = "black",
             position = "dodge") + 
  geom_point(aes(x = Percentile, y = mean), color = "light blue") + 
  geom_text(aes(x = Percentile, y = mean, label = ifelse(rank <14 | Percentile < 30, member_state, "")), check_overlap = T, 
                  size = 2,
                  hjust = "inward") + 
  theme_minimal() + 
  labs(#title = "Average Legislator Requests per Year by Percentile",
       x = "Percentile Within Chamber",
       y = "Average Requests per Year") +     facet_grid(. ~ chamber , scales = "free_y") 

Requests by year

dcounts %<>% 
  group_by(bioname, year) %>% 
  mutate(per_bioname_year = sum(per_icpsr_chamber_year_agency_type)) %>%
  ungroup() %>% 
  group_by(year) %>%
  #mutate(per_bioname_year = per_bioname_year - mean(per_bioname_year)) %>% 
  ungroup() 

schumer2013 <- dcounts %>% filter(bioname == "SCHUMER, Charles Ellis (Chuck)",
                   year == 2013) %>% .$per_bioname_year %>% unique()

cruz2013 <- dcounts %>% filter(bioname == "CRUZ, Rafael Edward (Ted)",
                   year == 2013) %>% .$per_bioname_year %>% unique()

mcconnell2013 <- dcounts %>% filter(bioname == "McCONNELL, Addison Mitchell (Mitch)",
                   year == 2013) %>% .$per_bioname_year %>% unique()


p <- dcounts %>% 
  filter(year > 2006, year <2018) %>%
  distinct(bioname, per_bioname_year, year, chamber) %>% 
  filter(per_bioname_year > 0) %>% 
  ggplot() + 
  geom_line(aes(x = year, 
                y = per_bioname_year, 
                group = bioname, 
                color = chamber), 
            alpha = .1) +
  geom_line(aes(x = year, 
                group = bioname, 
                color = chamber,
                y = ifelse(bioname == "SCHUMER, Charles Ellis (Chuck)", per_bioname_year, NA))) + 
  geom_label(x = 2013, 
             y = schumer2013, 
             label = "Chuck Schumer") +
  geom_line(aes(x = year, group = bioname, color = chamber,
                y = ifelse(bioname == "CRUZ, Rafael Edward (Ted)", per_bioname_year, NA))) + 
  geom_label(x = 2013, 
             y = cruz2013, 
             label = "Ted Cruz") +
  geom_line(aes(x = year, group = bioname, color = chamber,
                y = ifelse(bioname == "McCONNELL, Addison Mitchell (Mitch)", per_bioname_year, NA))) + 
  geom_label(x = 2013, 
             y = mcconnell2013, 
             label = "Mitch McConnell") +
  labs(x = "",
       color = " ",
       y = paste("Requests per Legislator per Year"),
       title = "") +
  scale_x_continuous(breaks = unique(dcounts$year)) + 
  scale_color_viridis_d(begin = 0, end = .6, option = "cividis", direction = -1) +
  theme_minimal() + 
  theme(panel.background = element_blank(),
        axis.ticks = element_blank(),
        axis.text.x = element_text(angle = 30, vjust = 0)) 

# FIXME, this takes a long time 
p

ggsave(here::here("figs/counts-per-year.pdf"), p, height=3, width=6)

Requests by state population

library(scales)


dcounts %>% 
  filter(chamber == "Senate") %>% 
    group_by(member_state, year, pop2010) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>% 
    group_by(member_state, pop2010) %>%
  summarise(mean = mean(n)) %>% ungroup() %>% 
    ggplot() + 
    geom_point(aes(x = pop2010, y = mean), color = "light blue") + 
    geom_smooth(aes(x = pop2010, y = mean)) + 
  geom_text_repel(aes(x = pop2010, 
                y = mean, 
                label = ifelse(mean > 260 |# & log(pop2010) < 17.4 | 
                                 mean < 80 & (log(pop2010) > 17 | log(pop2010) <14), 
                               member_state, 
                               "")), 
            seed = 44,
            check_overlap = T, 
            min.segment.length = 0,
            size = 2.5) + theme_bw() +
  labs(title = "",
       x = "State Population (log scale)",
       y = "Average Number of Requests per Year") +
  scale_x_log10(labels = comma)


Types of requests

84% of the average legislators’ contacts with agencies are about constituency service.

16% of the average legislators’ contacts with agencies are about policy work.

type n
Constituency Service
43616
Work
 8259

We classify legislator requests into five overall types:

All data:

# paper figure 
type_totals <- all_contacts2 %>% 
  filter(Type != "To be coded") %>%  
  mutate(total = n()) %>% 
  group_by(Type, total, type) %>% 
  summarise(nT = n()) %>% 
  mutate(percent = paste0(nT, " = ", 100*round(nT/total, 2), "%"),
         Type = str_c(Type, "\n    ", percent)) %>% 
  ungroup() %>% 
  group_by(type) %>% 
  mutate(nt = sum(nT),
         percent_t = paste0(100*round(nt/total, 2), "%"))

type_totals %<>% mutate(Type = Type %>% 
                          str_replace_all("\\)", "") %>% 
                          str_replace_all(" \\(", ",\n") )

# horizontal
type_totals %>% 
  ggplot() + 
  geom_col(alpha = .7,aes(x = Type, fill = type, y = nT) ) + 
  scale_y_continuous(breaks = seq(0,500000, 50000), limits = c(0,500000)) + 
  labs(x = "",
       fill = "",
       y = paste("Number of Contacts"),
       title = "") +
  #geom_text(aes(label = Type, x = Type,y = nT) ) + 
  theme(panel.border = element_blank(),
        panel.grid.major.x = element_blank(),
        axis.ticks = element_blank(),
        #axis.text.x.top = element_text(),
        legend.position ="none") + 
  ggpubr::geom_bracket(
    xmin = type_totals$Type[1], xmax = type_totals$Type[3], 
    y.position = 380000,
    label = paste(type_totals$percent_t[1], "Constituency Service" ),
    #hjust = 1,
    vjust = -1
  ) + 
  ggpubr::geom_bracket(
    xmin = type_totals$Type[4], xmax = type_totals$Type[5], 
    y.position = 85000,
    label = paste(type_totals$percent_t[5], "Policy Work"),
    #hjust = 1,
    vjust = -1
  )+ 
  scale_fill_viridis_d(option = "cividis", end = .8, direction = -1)

all_contacts2 %>% 
  filter(Type != "To be coded") %>%  
  mutate(total = n()) %>% 
  group_by(Type, total, type) %>% 
  summarise(nT = n()) %>% 
  mutate(percent = paste0(nT, " = ", 100*round(nT/total, 2), "%"),
         Type = str_c(Type, "\n    ", percent)) %>% 
  ungroup() %>% 
  #distinct(type, Type, nT)
  ggplot() + 
  geom_col(alpha = .7,aes(x = type, fill = Type, y = nT), position ="stack") + 
  #coord_flip() + 
  scale_y_continuous(labels = scales::comma) + 
  labs(x = "",
       fill = "",
       y = paste("Number of Contacts\nN =", sum(nrow(all_contacts2))),
       title = "") +
  #theme_void() + 
  theme(panel.border = element_blank(),
        panel.grid.major.x = element_blank(),
        axis.ticks = element_blank(),
        axis.text.x = element_text())

Horizontal format:

type_totals %<>% 
  #distinct(type, Type, nT)
  mutate(Type = Type %>% str_replace(",\n", ", ")) 

type_totals %>% 
  ggplot() + 
  geom_col(alpha = .7,aes(x = Type, fill = type, y = nT/1000) ) + 
  coord_flip() + 
  scale_y_continuous(breaks = seq(0,500, 100), limits = c(0,700)) + 
  labs(x = "",
       fill = "",
       y = paste("Number of Contacts (Thousands)"),
       title = "") +
  #theme_void() + 
  theme(panel.border = element_blank(),
        panel.grid.major.y = element_blank(),
        axis.ticks = element_blank(),
        axis.text.x.top = element_text(),
        legend.position ="none") + 
  ggpubr::geom_bracket(
    xmin = type_totals$Type[1], xmax = type_totals$Type[3], y.position = 400,
    label = paste0(type_totals$percent_t[1], "\n", type_totals$type[1]),
    hjust = -.3,
    vjust = 1.5,
    label.size = 3.5
  ) + 
  ggpubr::geom_bracket(
    xmin = type_totals$Type[4], xmax = type_totals$Type[5], y.position = 100,
    label = paste0(type_totals$percent_t[5], "\n", type_totals$type[5]),
    hjust = -.3,
    vjust = 1,
    label.size = 3.5
  )

all_contacts2 %>% 
  filter(Type != "To be coded") %>%  
  mutate(total = n()) %>% 
  group_by(Type, total, type) %>% 
  summarise(nT = n()) %>% 
  mutate(percent = paste0(nT, " = ", 100*round(nT/total, 2), "%"),
         Type = str_c(Type, "\n    ", percent)) %>% 
  ungroup() %>% 
  #distinct(type, Type, nT)
  ggplot() + 
  geom_col(alpha = .7,aes(x = type, fill = Type, y = nT/1000), position ="stack") + 
  coord_flip() + 
  scale_y_continuous(breaks = seq(0,500, 50)) + 
  labs(x = "",
       fill = "",
       y = paste("Number of Contacts (Thousands)"),
       title = "") +
  #theme_void() + 
  theme(panel.border = element_blank(),
        panel.grid.major.y = element_blank(),
        axis.ticks = element_blank(),
        axis.text.x.top = element_text())

2007-2017 data:

N <- all_contacts2 %>% 
  filter(year <2018,
         year > 2006) %>% 
  nrow()

all_contacts2 %>% 
  filter(Type != "To be coded",
         year <2018,
         year > 2006) %>%  
    mutate(total = n()) %>% 
  group_by(Type, total, type) %>% 
  summarise(nT = n()) %>% 
  mutate(percent = paste0(nT, " = ", 100*round(nT/total, 2), "%"),
         Type = str_c(Type, "\n    ", percent)) %>% 
  ungroup() %>% 
  #distinct(type, Type, nT)
  ggplot() + 
  geom_col(alpha = .7,aes(x = type, fill = Type, y = nT/1000), position ="stack") + 
  coord_flip() + 
  scale_y_continuous(breaks = seq(0,500, 50)) + 
  labs(x = "",
       fill = "",
       y = paste("Number of Contacts (Thousands)\nN =", N),
       title = "") +
  #theme_void() + 
  theme(panel.border = element_blank(),
        panel.grid.major.y = element_blank(),
        axis.ticks = element_blank(),
        axis.text.x.top = element_text())


Requests by institutional position

The first plot is the contacts we have coded. The second assumes these ratios hold for uncoded letters.

chairs <- all_contacts %>% distinct(icpsr, chair, year) 

d %<>% left_join(chairs) %>% 
  mutate(chair = chair %>%
           replace_na(0),
         Chair = ifelse(chair == 1, "Committee Chair", " Non-Chair"))

chair <- d %>% 
  group_by(type, year, icpsr, Chair) %>% 
  summarise(n = sum(per_icpsr_chamber_year_agency_type)) %>%
  group_by(type, Chair) %>% 
  summarise(mean = mean(n)) %>% 
  ungroup() %>%
  filter(!is.na(type))

chair %>% 
  ggplot()  + 
  aes(x = type, y = mean) +
  geom_col(alpha = .7,position = "dodge") + 
  facet_wrap("Chair") + 
  labs(x = "", # "Type of Legislator Request to Agency",
       y = "Average Requests per Year") +
  theme(panel.grid.major.x = element_blank(),
        panel.border = element_blank(),
        axis.ticks.x = element_blank())
Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

chair %>% 
  # assuming consistant proportions to uncoded data 
  mutate(mean = mean*multiplier) %>% 
  ggplot()  + 
  aes(x = type, y = mean) +
  geom_col(alpha = .7,position = "dodge") + 
  facet_wrap("Chair") + 
  labs(x = "Type of Legislator Request to Agency",
       y = "Average Requests per Year") +
  theme(panel.grid.major.x = element_blank(),
        panel.border = element_blank(),
        axis.ticks.x = element_blank())
Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

Level

Member-level

TODO

  • [ x ] members.Rdata going back to most senior member’s first Congress in “data/nominate.Rdata”
  • [ x ] what to do with party and chamber switchers? Drop them from counts.
#load(here::here('data', 'dcounts_min.Rdata'))

##creating the aggregate count variable
## one obs per agency, member, year 
d <- dcounts_min %>% 
  group_by(agency, icpsr, chamber, year) %>% 
  summarise(perYear = sum(per_icpsr_chamber_year_agency_type)) 

# dcounts_min %>% 
#   mutate(type2 = ifelse(TYPE %in% c(1,2,3), "policy", NA ),
#          type2 = ifelse(TYPE %in% c(4,5), "constituent", type2)) %>% 
#   group_by(type2, agency, icpsr, chamber, year) %>% 
#   # 2-type counts 
#   mutate(perYear_type2 = sum(per_icpsr_chamber_year_agency_type),
#          # versions with NAs for models
#          perYear_con = ifelse(type2 == "constituent", perYear_type2),
#          perYear_pol = ifelse(type2 == "policy", perYear_type2))
#   

# constituency service
d_sub <- dcounts_min %>%
  filter(TYPE %in% c(1, 2, 3)) %>%
  group_by(agency, icpsr, chamber, year) %>%
  summarise(perYear_con = sum(per_icpsr_chamber_year_agency_type))

# policy
d_sub2<- dcounts_min %>%
  subset(TYPE %in% c(4, 5)) %>%
  group_by(agency, icpsr, chamber, year) %>%
  summarise(perYear_pol = sum(per_icpsr_chamber_year_agency_type))


d %<>% left_join(d_sub) %>% left_join(d_sub2)

# congress
d$congress <- year_congress(d$year)

d %<>% left_join(members %>% 
                 select(congress, icpsr, party,party_code, state_abbrev, district_code, nominate.dim1, presidents_party, female, chair, ranking_minority, party_leader, party_whip, majority, prestige, prestige_chair, yearelected, state), by = c('congress', 'icpsr'))

#FIXME this should all be in members data 
# nom <- read_csv(here::here('data', 'nominate_data.csv'))
nom2<- members %>% 
  group_by(icpsr) %>% 
  summarise(first_cong = min(congress))

nom2$first_year <- 1787 + 2*nom2$first_cong

df<- left_join(d, nom2, by ='icpsr' )
#/FIXME 

# Tenure vars 
df$tenure<- df$year - df$first_year
df$first<- ifelse(df$tenure==0, 1, 0)
df$second<- ifelse(df$tenure==1, 1, 0)
df$third<- ifelse(df$tenure==2, 1, 0)
df$fourth<- ifelse(df$tenure==3, 1, 0)
df$fifth<- ifelse(df$tenure==4, 1, 0)
df$sixth<- ifelse(df$tenure==5, 1, 0)

# colnames(agency_vars)
df %<>% 
  #select(-oversight_committee, -oversight_committee_chair) %>% #FIXME these should be the same
  left_join(agency_vars %>% 
                    select(agency, icpsr, chamber, year, oversight_committee,
                           oversight_committee_chair), by = c('agency', 'icpsr', 'year', 'chamber')
            )

df$icpsr_agency<- paste(df$agency, df$icpsr, sep='_')
df$agency_year<- paste(df$agency, df$year, sep='_')

# tenure 
df %<>% ungroup() %>% 
  group_by(icpsr) %>% 
  mutate(max_year = max(tenure)) 

df$survive <- ifelse((df$chamber=='House' & df$max_year>1)| (df$chamber=='Senate' & df$max_year>5),1, 0 )


##purging repeated values 
#FIXME repeats are probably chamber switchers
df %<>% 
  add_count(icpsr, year, agency, chamber, 
            name = "n") 

#FIXME !!! 
doubles <- filter(df, n>1) # no doubles (doubles were chamber-switchers)

doubles %>% kablebox()
agency icpsr chamber year perYear perYear_con perYear_pol congress party party_code state_abbrev district_code nominate.dim1 presidents_party female chair ranking_minority party_leader party_whip majority prestige prestige_chair yearelected state first_cong first_year tenure first second third fourth fifth sixth oversight_committee oversight_committee_chair icpsr_agency agency_year max_year survive n
Amtrak 14435 House 2013 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA Amtrak_14435 Amtrak_2013 23 1 2
Amtrak 14435 House 2013 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA Amtrak_14435 Amtrak_2013 23 1 2
Amtrak 14435 House 2014 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA Amtrak_14435 Amtrak_2014 23 1 2
Amtrak 14435 House 2014 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA Amtrak_14435 Amtrak_2014 23 1 2
Amtrak 14435 Senate 2013 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA Amtrak_14435 Amtrak_2013 23 1 2
Amtrak 14435 Senate 2013 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA Amtrak_14435 Amtrak_2013 23 1 2
Amtrak 14435 Senate 2014 1 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 0 0 Amtrak_14435 Amtrak_2014 23 1 2
Amtrak 14435 Senate 2014 1 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 0 0 Amtrak_14435 Amtrak_2014 23 1 2
Amtrak 20115 House 2009 0 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 8 0 0 0 0 0 0 NA NA Amtrak_20115 Amtrak_2009 15 1 2
Amtrak 20115 House 2009 0 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 8 0 0 0 0 0 0 NA NA Amtrak_20115 Amtrak_2009 15 1 2
Amtrak 20115 House 2010 1 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 9 0 0 0 0 0 0 0 0 Amtrak_20115 Amtrak_2010 15 1 2
Amtrak 20115 House 2010 1 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 9 0 0 0 0 0 0 0 0 Amtrak_20115 Amtrak_2010 15 1 2
Amtrak 20115 Senate 2009 0 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 8 0 0 0 0 0 0 NA NA Amtrak_20115 Amtrak_2009 15 1 2
Amtrak 20115 Senate 2009 0 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 8 0 0 0 0 0 0 NA NA Amtrak_20115 Amtrak_2009 15 1 2
Amtrak 20115 Senate 2010 0 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 9 0 0 0 0 0 0 NA NA Amtrak_20115 Amtrak_2010 15 1 2
Amtrak 20115 Senate 2010 0 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 9 0 0 0 0 0 0 NA NA Amtrak_20115 Amtrak_2010 15 1 2
Amtrak 20730 House 2011 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA Amtrak_20730 Amtrak_2011 11 1 2
Amtrak 20730 House 2011 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA Amtrak_20730 Amtrak_2011 11 1 2
Amtrak 20730 House 2012 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA Amtrak_20730 Amtrak_2012 11 1 2
Amtrak 20730 House 2012 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA Amtrak_20730 Amtrak_2012 11 1 2
Amtrak 20730 Senate 2011 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA Amtrak_20730 Amtrak_2011 11 1 2
Amtrak 20730 Senate 2011 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA Amtrak_20730 Amtrak_2011 11 1 2
Amtrak 20730 Senate 2012 1 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 0 0 Amtrak_20730 Amtrak_2012 11 1 2
Amtrak 20730 Senate 2012 1 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 0 0 Amtrak_20730 Amtrak_2012 11 1 2
Amtrak 20735 House 2009 1 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 0 0 Amtrak_20735 Amtrak_2009 13 1 2
Amtrak 20735 House 2009 1 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 0 0 Amtrak_20735 Amtrak_2009 13 1 2
Amtrak 20735 House 2010 0 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 NA NA Amtrak_20735 Amtrak_2010 13 1 2
Amtrak 20735 House 2010 0 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 NA NA Amtrak_20735 Amtrak_2010 13 1 2
Amtrak 20735 Senate 2009 0 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 NA NA Amtrak_20735 Amtrak_2009 13 1 2
Amtrak 20735 Senate 2009 0 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 NA NA Amtrak_20735 Amtrak_2009 13 1 2
Amtrak 20735 Senate 2010 2 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 0 0 Amtrak_20735 Amtrak_2010 13 1 2
Amtrak 20735 Senate 2010 2 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 0 0 Amtrak_20735 Amtrak_2010 13 1 2
Amtrak 29534 House 2007 0 0 0 110
200 MS 0 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 10 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2007 23 1 2
Amtrak 29534 House 2007 0 0 0 110
200 MS 1 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 10 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2007 23 1 2
Amtrak 29534 House 2008 0 0 0 110
200 MS 0 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2008 23 1 2
Amtrak 29534 House 2008 0 0 0 110
200 MS 1 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2008 23 1 2
Amtrak 29534 Senate 2007 0 0 0 110
200 MS 0 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 10 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2007 23 1 2
Amtrak 29534 Senate 2007 0 0 0 110
200 MS 1 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 10 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2007 23 1 2
Amtrak 29534 Senate 2008 0 0 0 110
200 MS 0 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2008 23 1 2
Amtrak 29534 Senate 2008 0 0 0 110
200 MS 1 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA Amtrak_29534 Amtrak_2008 23 1 2
CNCS 14435 House 2013 1 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 0 0 CNCS_14435 CNCS_2013 23 1 2
CNCS 14435 House 2013 1 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 0 0 CNCS_14435 CNCS_2013 23 1 2
CNCS 14435 House 2014 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CNCS_14435 CNCS_2014 23 1 2
CNCS 14435 House 2014 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CNCS_14435 CNCS_2014 23 1 2
CNCS 14435 Senate 2013 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA CNCS_14435 CNCS_2013 23 1 2
CNCS 14435 Senate 2013 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA CNCS_14435 CNCS_2013 23 1 2
CNCS 14435 Senate 2014 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CNCS_14435 CNCS_2014 23 1 2
CNCS 14435 Senate 2014 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CNCS_14435 CNCS_2014 23 1 2
CNCS 20115 House 2009 0 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 8 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2009 15 1 2
CNCS 20115 House 2009 0 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 8 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2009 15 1 2
CNCS 20115 House 2010 0 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 9 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2010 15 1 2
CNCS 20115 House 2010 0 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 9 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2010 15 1 2
CNCS 20115 Senate 2009 0 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 8 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2009 15 1 2
CNCS 20115 Senate 2009 0 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 8 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2009 15 1 2
CNCS 20115 Senate 2010 0 0 0 111
200 IL 0 0.274 0 0 0 0 0 0 NA 1 0 NA illinois 107 2001 9 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2010 15 1 2
CNCS 20115 Senate 2010 0 0 0 111
200 IL 10 0.274 0 0 0 0 0 0 0 1 0 2008 illinois 107 2001 9 0 0 0 0 0 0 NA NA CNCS_20115 CNCS_2010 15 1 2
CNCS 20730 House 2011 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CNCS_20730 CNCS_2011 11 1 2
CNCS 20730 House 2011 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CNCS_20730 CNCS_2011 11 1 2
CNCS 20730 House 2012 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CNCS_20730 CNCS_2012 11 1 2
CNCS 20730 House 2012 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CNCS_20730 CNCS_2012 11 1 2
CNCS 20730 Senate 2011 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CNCS_20730 CNCS_2011 11 1 2
CNCS 20730 Senate 2011 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CNCS_20730 CNCS_2011 11 1 2
CNCS 20730 Senate 2012 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CNCS_20730 CNCS_2012 11 1 2
CNCS 20730 Senate 2012 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CNCS_20730 CNCS_2012 11 1 2
CNCS 20735 House 2009 0 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 NA NA CNCS_20735 CNCS_2009 13 1 2
CNCS 20735 House 2009 0 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 NA NA CNCS_20735 CNCS_2009 13 1 2
CNCS 20735 House 2010 0 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 NA NA CNCS_20735 CNCS_2010 13 1 2
CNCS 20735 House 2010 0 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 NA NA CNCS_20735 CNCS_2010 13 1 2
CNCS 20735 Senate 2009 0 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 NA NA CNCS_20735 CNCS_2009 13 1 2
CNCS 20735 Senate 2009 0 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 2 0 0 1 0 0 0 NA NA CNCS_20735 CNCS_2009 13 1 2
CNCS 20735 Senate 2010 4 0 0 111
100 NY 0 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 0 0 CNCS_20735 CNCS_2010 13 1 2
CNCS 20735 Senate 2010 4 0 0 111
100 NY 20 -0.474 1 1 0 0 0 0 1 1 0 2008 new york 110 2007 3 0 0 0 1 0 0 0 0 CNCS_20735 CNCS_2010 13 1 2
CSOSA 14435 House 2013 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2013 23 1 2
CSOSA 14435 House 2013 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2013 23 1 2
CSOSA 14435 House 2014 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2014 23 1 2
CSOSA 14435 House 2014 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2014 23 1 2
CSOSA 14435 Senate 2013 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2013 23 1 2
CSOSA 14435 Senate 2013 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2013 23 1 2
CSOSA 14435 Senate 2014 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2014 23 1 2
CSOSA 14435 Senate 2014 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA CSOSA_14435 CSOSA_2014 23 1 2
CSOSA 20730 House 2011 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CSOSA_20730 CSOSA_2011 11 1 2
CSOSA 20730 House 2011 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CSOSA_20730 CSOSA_2011 11 1 2
CSOSA 20730 House 2012 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CSOSA_20730 CSOSA_2012 11 1 2
CSOSA 20730 House 2012 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CSOSA_20730 CSOSA_2012 11 1 2
CSOSA 20730 Senate 2011 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CSOSA_20730 CSOSA_2011 11 1 2
CSOSA 20730 Senate 2011 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 4 0 0 0 0 1 0 NA NA CSOSA_20730 CSOSA_2011 11 1 2
CSOSA 20730 Senate 2012 0 0 0 112
200 NV 0 0.463 0 0 0 0 0 0 0 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CSOSA_20730 CSOSA_2012 11 1 2
CSOSA 20730 Senate 2012 0 0 0 112
200 NV 2 0.463 0 0 0 0 0 0 1 1 0 2010 nevada 110 2007 5 0 0 0 0 0 1 NA NA CSOSA_20730 CSOSA_2012 11 1 2
CSOSA 29534 House 2008 0 0 0 110
200 MS 0 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA CSOSA_29534 CSOSA_2008 23 1 2
CSOSA 29534 House 2008 0 0 0 110
200 MS 1 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA CSOSA_29534 CSOSA_2008 23 1 2
CSOSA 29534 Senate 2008 0 0 0 110
200 MS 0 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA CSOSA_29534 CSOSA_2008 23 1 2
CSOSA 29534 Senate 2008 0 0 0 110
200 MS 1 0.376 1 NA 0 0 0 0 0 1 0 2006 mississippi 105 1997 11 0 0 0 0 0 0 NA NA CSOSA_29534 CSOSA_2008 23 1 2
DHHS_ACF 14435 House 2013 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA DHHS_ACF_14435 DHHS_ACF_2013 23 1 2
DHHS_ACF 14435 House 2013 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA DHHS_ACF_14435 DHHS_ACF_2013 23 1 2
DHHS_ACF 14435 House 2014 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA DHHS_ACF_14435 DHHS_ACF_2014 23 1 2
DHHS_ACF 14435 House 2014 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 NA NA DHHS_ACF_14435 DHHS_ACF_2014 23 1 2
DHHS_ACF 14435 Senate 2013 0 0 0 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA DHHS_ACF_14435 DHHS_ACF_2013 23 1 2
DHHS_ACF 14435 Senate 2013 0 0 0 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 16 0 0 0 0 0 0 NA NA DHHS_ACF_14435 DHHS_ACF_2013 23 1 2
DHHS_ACF 14435 Senate 2014 1 0 1 113
100 MA 0 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 0 0 DHHS_ACF_14435 DHHS_ACF_2014 23 1 2
DHHS_ACF 14435 Senate 2014 1 0 1 113
100 MA 5 -0.511 1 0 0 1 0 0 0 1 0 2012 massachusetts 105 1997 17 0 0 0 0 0 0 0 0 DHHS_ACF_14435 DHHS_ACF_2014 23 1 2
# drop doubles 
df %<>% filter(n<2) 


# LEVEL MODELS

df %<>% 
  # mutate(agency_year) %>% 
  mutate(lpyear = log(perYear + 1))

District-level

####
# Redistricting? were most maps in place by 2011?
decade<- case_when(df$year < 2011 ~ '0', 
                   df$year > 2010 ~ '1')

state_dist<- case_when(df$chamber=='Senate'~ paste(df$state,
                                                    df$district_code, 
                                                    sep='_' ), 
                       df$chamber =='House'~ paste(paste(df$state, 
                                                          df$district_code, 
                                                          sep='_'), 
                                                    decade,
                                                    sep='_'))




df$state_dist<- state_dist

perDist<- df %>% 
  group_by(year, state_dist, icpsr, chamber, tenure, state) %>% 
  summarise(perYear = sum(perYear)) %>%
  distinct()



## Now, we want to identify when there is a new member in a district.  To do this, we look for changes in the icpsr number
perDist$new_member<- ifelse(perDist$tenure==0, 1, 0)

perDist$second_year<- ifelse(perDist$tenure==1, 1, 0)
perDist$third_year<- ifelse(perDist$tenure==2, 1, 0)
perDist$fourth_year<- ifelse(perDist$tenure==3, 1, 0)
perDist$fifth_year<- ifelse(perDist$tenure==4, 1, 0)
perDist$sixth_year<- ifelse(perDist$tenure==5, 1, 0)


state_level<- perDist %>% group_by(state, year) %>% 
  summarise(numpers = n(), 
            sumYear = sum(perYear), 
            mean_new = mean(new_member)) 

state_new <- ifelse(state_level$mean_new>0, 1, 0)

state_level$state_new <- state_new

perDist %<>% left_join(state_level %>% 
                         select(state_new, mean_new, state, year), 
                    by = c('state', 'year'))
#########################
# saved as DistrictLevel
########################
# save(perDist, file =  here::here("data", "perDist.Rdata"))
############################################

TODO

Priority

##creating the ratio variable 
d_rat <- df %>% 
  group_by(year, icpsr, chamber,
           prestige, prestige_chair, chair, ranking_minority, majority, presidents_party,
           first, second, third, fourth, fifth, sixth) %>% 
  # per member per year counts per type2
  summarise(perCon = sum(perYear_con), 
            perPol = sum(perYear_pol)) %>% 
  # ratio of con to pol 
  #FIXME switch? 
  mutate(ratio = perCon/(perCon + perPol))

# drop doubles
d_rat %<>% group_by(year, icpsr, chamber) %>% add_count(name = "n")

doubles_ratio <- filter(d_rat, n>1)

doubles_ratio %>% kablebox()
year icpsr chamber prestige prestige_chair chair ranking_minority majority presidents_party first second third fourth fifth sixth perCon perPol ratio n
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
—-: —–: :——- ——–: ————–: —–: —————-: ——–: —————-: —–: ——: —–: ——: —–: —–: ——: ——: —–: –:
d_rat %<>% filter(n<2) 

############################################
# d_rat saved as ProportionContact.dta')
# save(d_rat, file =  here::here("data", "d_rat.Rdata"))
############################################

# RATIO MODEL 

TODO

Joint Effect of Capacity and Priority

We observe the total requests, \(z\), and ratio, \(r\), of policy work to constituency service. \(z\) is the sum of policy requests \(x\) and constituency service requests \(y\). \(r\) is \(x/y\)./

r = .2

r2 = .31

z = 100

x = z*r
y = z-z*r


z2 = 120

x2 = z2*r2
y2 = z2-z2*r2

Combining model estimates for the shift in the level of requests and relative priority of policy work to constituency service, we see that even as the ratio of policy work increases, constituency service also significantly increases.

These estimates are calculated by adding diff-in-diff regression coefficients for committee chairs’ increased levels of requests to the baseline levels for non-chairs. We also adjust the ratio of policy work to constituency service based on the diff-in-diff regression coefficients for committee chairs’ increased policy work ratio.

#FIXME replace with tidy model output 
# TABLE 1
level <- tribble(~term, ~estimate, ~std.error,
                 "chair", 0.206, 0.0951)

# per member across all agencies 
level$estimate <- level$estimate*n_agencies
level$std.error <- level$std.error*n_agencies

# ratio of policy work for non-chairs
base_ratio <- chair$mean[3]/chair$mean[1]

# level estimates with baseline ratio (for presenting level effects only)
level_con <- level %>% mutate(estimate = estimate*(1-base_ratio),
                               std.error = std.error*(1-base_ratio))

level_pol <- level %>% mutate(estimate = estimate*(base_ratio),
                               std.error = std.error*(base_ratio))


# Priority Table 
priority <- tribble(~term, ~estimate, ~std.error,
                 "chair", 0.0875, 0.0175)

# adjust level estimates with new ratio (joint effects )
new_ratio <- base_ratio + priority$estimate[1]

level_con <- level %>% mutate(estimate = estimate*(1-new_ratio),
                               std.error = std.error*(1-new_ratio))

level_pol <- level %>% mutate(estimate = estimate*(new_ratio),
                               std.error = std.error*(new_ratio))


#FIXME, include priority model uncertianty too
chair$std.error <- NA
# constituent error 
chair$std.error[2] <- level_con$std.error[1]
# policy error
chair$std.error[4] <- level_pol$std.error[1]


# chair mean = non-chair mean * level coef
# constituent estimate 
chair$mean[2] <- chair$mean[1] + (1 + level_con$estimate[1] )
# policy estimate
chair$mean[4] <- chair$mean[3] + (1+level_pol$estimate[1] )

chair_adjusted <- chair %>% 
  # assuming consistant proportions to uncoded data 
  mutate(mean = mean*multiplier) %>%
  # baseline = non-chairs mean
  mutate(baseline = ifelse(Chair == "Committee Chair", NA, mean) ) %>%
  fill(baseline) %>%
  # point estimates and uncertiatty only for chair estimates 
  mutate(estimate = ifelse(Chair == "Committee Chair", mean, NA)) %>% 
  mutate(std.error = ifelse(Chair == "Committee Chair", std.error, NA)) 

chair_adjusted %>% 
  #mutate(Chair = ifelse() )
  ggplot()  + 
  aes(x = type, y = mean) +
  geom_col(alpha = .7, position = "dodge") + 
  geom_hline(aes(yintercept = baseline), linetype = 2) + 
  geom_pointrange(aes(y = estimate,
                      ymin = mean-1.96*std.error,
                      ymax = mean+1.96*std.error)) + 
  facet_wrap("Chair") + 
  labs(x = "", #Type of Legislator Request to Agency",
       y = "Average Requests per Year") +
  theme(panel.grid.major.x = element_blank(),
        panel.border = element_blank(),
        axis.ticks.x = element_blank())
Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

chair_adjusted %<>% mutate(baseline = ifelse(type =="Constituency\nService", baseline+ 12.4, baseline))


# stacked to show ratio with PERCENTS 
chair_adjusted %>% 
  #mutate(Chair = ifelse() )
  ggplot()  + 
  aes(x = Chair, y = mean, fill = type) +
  geom_col(alpha = .7, position = "fill") +  
  facet_wrap("Chair", scales = "free_x") + 
  labs(x = "", #Type of Legislator Request to Agency",
       y = "Share of Requests per Year",
       fill = "") +
  theme(panel.grid.major.x = element_blank(),
        axis.text.x = element_blank(),
        panel.border = element_blank(),
        axis.ticks.x = element_blank())
Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

# stacked to show ratio + free scales 
chair_adjusted %>% 
  #mutate(Chair = ifelse() )
  ggplot()  + 
  aes(x = Chair, y = mean, fill = type) +
  geom_col(alpha = .7, position = "stack") + 
  #geom_hline(aes(yintercept = baseline), linetype = 2) + 
  #geom_pointrange(aes(y = estimate,
                      #ymin = mean-1.96*std.error,
                      #ymax = mean+1.96*std.error)) + 
  facet_wrap("Chair", scales = "free") + 
  #scale_y_
  labs(x = "", #Type of Legislator Request to Agency",
       y = "Average Requests per Year",
       fill = "") +
  theme(panel.grid.major.x = element_blank(),
        axis.text.x = element_blank(),
        panel.border = element_blank(),
        axis.ticks.x = element_blank())
Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

# stacked to show ratio + CI
chair_adjusted %>% 
  #mutate(Chair = ifelse() )
  ggplot()  + 
  aes(x = Chair, y = mean, fill = type) +
  geom_col(alpha = .7, position = "stack") + 
  geom_hline(aes(yintercept = baseline), linetype = 2) + 
  geom_pointrange(aes(y = estimate,
                      ymin = mean-1.96*std.error,
                      ymax = mean+1.96*std.error)) + 
  facet_wrap("Chair", scales = "free") + 
  labs(x = "", #Type of Legislator Request to Agency",
       y = "Average Requests per Year",
       fill = "") +
  theme(panel.grid.major.x = element_blank(),
        axis.text.x = element_blank(),
        panel.border = element_blank(),
        axis.ticks.x = element_blank())
Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

Difference-in-Difference Estimates of Change in Levels of Constituency Service and Policy Work as Legislators Gain Power

The baseline level (non-chairs) is 75.4521884 constituency service requests and 13.0828967 policy requests per year.

The baseline ratio (for non-chairs) of policy work to constituency service is 0.1733932. Adding the model coefficient from the difference in difference model of shifting priorities yields a new ratio of 0.2608932.

The model-estimated level for committee chairs is 93.4026395 constituency service requests and 20.1930186 policy requests per year.

#TODO

  • [ x ] remove the title from state pop figure